import { Numeric } from '../scalar';
import { SQL_SYMBOLE } from '../sql';
import { DBObject, pickName } from './db-object';

export class Sequence<
  T extends Numeric = Numeric,
  N extends string = string
  // K extends FUNCTION_TYPE = FUNCTION_TYPE.SCALAR
> extends DBObject<N> {
  readonly $type: SQL_SYMBOLE.SEQUENCE = SQL_SYMBOLE.SEQUENCE;

  /**
   * 获取值
   */
  nextValue(): Expression<T> {
    return SQL.nextValue(pickName(this.$name));
  }
}

import type { Expression } from '../expression';
import { SQL } from '../../sql-builder';
